package com.imooc.miaosha.redis;

public abstract class BasePrefix implements KeyPrefix {
	private int expireSecends;
	private String prefix;

	public BasePrefix(int expireSecends, String prefix) {
		this.expireSecends = expireSecends;
		this.prefix = prefix;
	}

	public BasePrefix(String prefix) {
		this.expireSecends = 0;
		this.prefix = prefix;
	}

	@Override
	public int expireSecends() {
		return expireSecends;
	}

	@Override
	public String getPrefix() {
		String className = getClass().getSimpleName();
		return className+":"+prefix;
	}
}
